package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class PwDemo {
    public static void main(String[] args) throws FileNotFoundException {
        /*PrintWriter pw = new PrintWriter("pw.txt");
        pw.println("hello world");
        pw.println("aaaaaaaa");
        System.out.println("写出完毕");
        pw.close();*/
        FileOutputStream fos = new FileOutputStream("pw2.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bos = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bos);
        pw.println("hello world");
        pw.println("aaaaaaaa");
        System.out.println("写出完毕");
        pw.close();

    }
}
